import * as echarts from 'echarts'
import { useEffect, useRef } from 'react'
const BarChart = ({option, style ={width: '100%', height: '300px'}}) => {
    const chartRef = useRef(null)

    useEffect(() => {
        const chart = echarts.init(chartRef.current)
        
        option && chart.setOption(option)
    }, [option])
    return (
            <div ref={chartRef} style={style}></div>
    )
}

export default BarChart